<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <input v-model="num1" type="text" />
      <span>*</span>
      <input v-model="num2" type="text" />
      <span>=</span>
      <span>{{result}}</span>
      <div v-bind:class="result"></div>
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          num1: 0,
          num2: 0,
        },
        computed: {
          result() {
            return Number(this.num1) * Number(this.num2);
          },
        },
      });
      // 计算属性的本质是一个函数，但是用的时候
      // 就把他当普通属性来用
      // 普通属性可以怎么用，计算属性就能怎么用
    </script>
  </body>
</html>
